/**
 * Project Name:gc.sms.mvn
 * File Name:PositionDaoImpl.java
 * Package Name:com.clps.dev.sms.dao.impl
 * Date:2018-11-27 16:36:38
 * Copyright (c) 2018,http://www.clpsglobal.com/zh/home-cn/ All Rights Reserved.
 *
 */
package com.clps.dev.sms.dao.sm.impl;


import java.util.List;

import org.springframework.stereotype.Repository;

import com.clps.dev.sms.common.dao.impl.BaseDaoImpl;
import com.clps.dev.sms.dao.sm.PositionDao;
import com.clps.dev.sms.entity.sm.Position;

/**
 * ClassName: PositionDaoImpl <br/>
 * Description: PositionDaoImpl.class. <br/><br/>
 *
 * @author Jack.Huang
 * @version V1.0
 * @since JDK 1.8
   @date:2018-11-27 16:36:38
 */
@Repository
public class PositionDaoImpl extends BaseDaoImpl<Position> implements PositionDao {

	/**
	 * Creates a new instance of PositionDaoimpl.
	 *
	 * @param clazz
	 */
	
	public PositionDaoImpl() {
		super(Position.class);
	}

	/**
	 * 
	 * @see com.clps.dev.sms.dao.PositionDao#queryByName(java.lang.String)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Position queryByName(String name) {
		String hql = "from Position where positionName = ?";
		List<Position> list = (List<Position>) this.getHibernateTemplate().find(hql, name);
		if(list!=null) {
			return list.get(0);
		}
		return null;
	}

	/**
	 *
	 * @see com.clps.dev.sms.dao.PositionDao#queryLikeName(java.lang.String)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Position> queryLikeName(String name) {
		String hql = "from Position where positionName like '%"+name+"%'";
		List<Position> list = (List<Position>) this.getHibernateTemplate().find(hql);
		return list;
	}

	

}
